<?php 
class User {
	public function fetch_all () {
		global $pdo;
		$query = $pdo->prepare('SELECT * FROM users');
		$query->execute();
		return array('length' => $query->rowCount() , 'data' => $query->fetchAll());
	}
	public function paging ($sta,$num) {
		global $pdo;
		$startRow = is_numeric($sta) ? $sta : 0;
		$rowNum = (int)$num;
		$query = $pdo->prepare('SELECT * FROM users LIMIT ? , ? ');
		$query->bindValue(1, $startRow , PDO::PARAM_INT);
		$query->bindValue(2, $rowNum , PDO::PARAM_INT);
		$query->execute();
		return $query->fetchAll();
	}
	public function adduser(){
		
	}
}
?>

<?php
// class Article{
// 	public function fetch_all(){
// 		global $pdo;

// 		$query = $pdo->prepare("SELECT * FROM articles ");
// 		$query->execute();

// 		return $query->fetchAll();
// 	}

// 	public function fetch_data($article_id){
// 		global $pdo;

// 		$query = $pdo->prepare("SELECT * FROM articles WHERE article_id = ? ");
// 		$query->bindValue(1,$article_id);
// 		$query->execute();

// 		return $query->fetch();
// 	}
// }
?>